<template>
  <el-container style="height: 900px; border: 5px solid #eee">
    <el-aside width="200px">
      <el-menu :unique-opened="true" :router="true">
        <el-submenu index="1" v-if="userIdentity === 'ad'">
          <template slot="title"><i class="el-icon-s-custom" style="color: orange"></i>会员信息</template>
          <el-menu-item index="regist" :to="{ name: 'Regist' }">会员注册</el-menu-item>
          <el-menu-item index="list" :to="{ name: 'List' }">全部会员</el-menu-item>
        </el-submenu>
        <el-submenu index="2" v-if="userIdentity === 'mem'">
          <template slot="title"><i class="el-icon-postcard" style="color: orange"></i>卡务中心</template>
          <el-menu-item index="cardsRules" :to="{ name: 'CardsRules' }">
            <i class="el-icon-document" style="color: orange"></i>办卡说明
          </el-menu-item>
        </el-submenu>
        <el-submenu index="2" v-if="userIdentity === 'ad'">
          <template slot="title"><i class="el-icon-postcard" style="color: orange"></i>卡务中心</template>
          <el-menu-item index="renew" :to="{ name: 'Renew' }">会员卡操作</el-menu-item>
          <el-menu-item index="cardsRules" :to="{ name: 'CardsRules' }">
            <i class="el-icon-document" style="color: orange"></i>办卡说明
          </el-menu-item>
        </el-submenu>
      
        <el-menu-item @click="goToEvaluate" v-if="userIdentity === 'mem'" class="evaluate-button">
          <i class="el-icon-star-on"></i>评价
        </el-menu-item>
      
        <el-menu-item @click="goToAllEvaluate" class="all-evaluate-button">
          <i class="el-icon-document-checked"></i>全部评价
        </el-menu-item>
        <el-menu-item @click="goToHome">
          <i class="el-icon-back"></i>返回
        </el-menu-item>
      </el-menu>
    </el-aside>
    <main class="main" style="flex: 1; display: flex; overflow: auto;">
      <router-view></router-view>
    </main>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      userIdentity: '', 
      currentPage: 1,
      pagesize: 10,
      total: 0,
      orderList: [],
    };
  },
  mounted() {

    this.userIdentity = localStorage.getItem('userIdentity');
    console.log('当前用户身份：', this.userIdentity);
  },
  methods: {
    goToHome() {
      this.$router.push("/home");
    },
  
    goToEvaluate() {
      this.$router.push("/evaluate");
    },

    goToAllEvaluate() {
      this.$router.push("/allevaluate");
    }
  }
}
</script>

<style scoped>
.main {
  background-image: url('../assets/img/vip.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0;
  margin: 0;
}

.header {
  background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.aside {
  color: #333;
}

</style>